package ao.ai.ml.demo.supervised.regression;

import ao.ai.ml.algo.supervised.model.example.ext.RegressionExample;
import ao.ai.ml.model.feature_set.ext.num.SingleNumericalFeature;
import ao.ai.ml.model.feature_set.impl.FeatureScalar;
import ao.ai.ml.model.feature_type.FeatureType;
import ao.ai.ml.model.feature_type.impl.FeatureTypeImpl;

/**
 * User: aostrovsky
 * Date: 6-Feb-2010
 * Time: 12:25:58 AM
 */
public class XyExample
        implements RegressionExample
{
    //--------------------------------------------------------------------
    private static final FeatureType X_TYPE = new FeatureTypeImpl("x");
    private static final FeatureType Y_TYPE = new FeatureTypeImpl("y");


    //--------------------------------------------------------------------
    private final int x;
    private final int y;


    //--------------------------------------------------------------------
    public XyExample(
            int xCoordinate,
            int yCoordinate)
    {
        x = xCoordinate;
        y = yCoordinate;
    }


    //--------------------------------------------------------------------
    @Override
    public SingleNumericalFeature input()
    {
        return new FeatureScalar(x, X_TYPE);
    }

    @Override
    public SingleNumericalFeature output()
    {
        return new FeatureScalar(y, Y_TYPE);
    }


    //--------------------------------------------------------------------
    @Override
    public String toString()
    {
        return "[" + x + "," + y + "]";
    }
}
